﻿namespace BorgExt
{
    public class ExceptionEventArgs
    {
        private readonly object _exceptionObject;
        private bool _isHandled;
        private readonly bool _isTerminating;

        public object ExceptionObject
        {
            get { return _exceptionObject; }
        }

        public bool IsHandled
        {
            get { return _isHandled; }
            set
            {
                if (_isHandled)
                    return;
                
                _isHandled = value;
            }
        }

        public bool IsTerminating
        {
            get { return _isTerminating; }
        }

        public ExceptionEventArgs(object exceptionObject)
            : this(exceptionObject, false)
        { }

        public ExceptionEventArgs(object exceptionObject, bool isTerminating)
        {
            _exceptionObject = exceptionObject;
            _isTerminating = isTerminating;
        }
    }

    public delegate void ExceptionEventHandler(ExceptionEventArgs args);
}

